package leet.ku._101;

class TreeNode {
	int val;
	TreeNode left;
	TreeNode right;

	TreeNode(int x) {
		val = x;
	}
}

public class Solution {
	
	public boolean isSymmetric(TreeNode root) {
		return root == null || isSymmetric(root.left, root.right);
	}
	
	private boolean isSymmetric(TreeNode rootOne, TreeNode rootTwo) {
		if (rootOne == null && rootTwo == null)
			return true;
		if (rootOne == null || rootTwo == null)
			return false;
		return rootOne.val == rootTwo.val && isSymmetric(rootOne.left, rootTwo.right) && isSymmetric(rootOne.right, rootTwo.left);
	}
}